package com.leimo.demo.service.impl;

import com.leimo.demo.service.DemoService;
import com.leimo.demo.service.DemoService3;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Method;

@DubboService(version = "1.0.0", methods = {@Method(name = "sayHello", timeout = 250, retries = 2)})
public class DemoServiceImpl implements DemoService {

  @DubboReference(version = "1.0.0")
  private DemoService3 demoService3;

  @Override
  public String sayHello(String name) {
    String s = demoService3.server2(name);
    return "Hello " + s;
  }

  @Override
  public String methodTimeout(){
    try {
      Thread.sleep(10);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    return "Timeout";
  }
}
